//弹出框      xxxxx
function showDialog(myText){
    layer.alert(myText, {
        icon: 2,
        skin: 'layer-ext-moon'
    });
}
function showDialogsuc(myText){
    layer.alert(myText, {
        icon: 1,
        skin: 'layer-ext-moon'
    });
}
//确认框跳转
function showDialogsucurl(message,url){
    layer.open({
        content:message,
        icon:1,
        yes:function(){
            location.href = url;
        },
        end:function(){
            location.href = url;
        }
    })
}
//确认框刷新
function showDialogsucur2(message){
    layer.open({
        content:message,
        icon:1,
        yes:function(){
        	location.reload(); 
        }
    })
}
function showDialogConfirm(message, url) {
    layer.open({
        content : message,
        icon:3,
        btn : ['是','否'],
        yes : function(){
            location.href=url;
        },
    })
}
//短信验证码
var countdown=60;
function daojishi(obj){
    if(countdown == 0){
        obj.attr('disabled',false); 
        obj.text("重新获取"); 
        countdown = 60; 
        return;
    }else { 
        obj.attr("disabled", true);
        obj.click(function(event){
            return false;
        })
        obj.text("重新发送("+ countdown + "s)"); 
        countdown--; 
    }
    setTimeout(function(){ 
        daojishi(obj)},1000); 
};

// 验证手机号码
function checkphone(phone){
    if(!(/^1[34578]\d{9}$/.test(phone))||phone==""){
        return false;
    }else{
        return true;
    }
}


//返回顶部
function returnTop(obj){
    var scrollTop = 0;
    $(window).scroll(function(){
        scrollTop = $(window).scrollTop();
        if(scrollTop > 700){
            obj.fadeIn(400);
        }else{
            obj.fadeOut(400);
        }
    });
    obj.on('click',function(){
        scrollTop = 0;
        $(document.body).animate({scrollTop:0},500);
        $(document.documentElement).animate({scrollTop:0},500);
    })
}
